package com.iyundao.io.mapper;

import com.iyundao.io.model.PermissionMenu;
import org.springframework.stereotype.Repository;

import static org.apache.ibatis.jdbc.SqlBuilder.*;

@Repository
public class PermissionMenuSqlProvider {

    public String insertSelective(PermissionMenu record) {
        BEGIN();
        INSERT_INTO("permission_menu");
        
        if (record.getSid() != null) {
            VALUES("sid", "#{sid,jdbcType=CHAR}");
        }
        
        if (record.getPid() != null) {
            VALUES("pid", "#{pid,jdbcType=CHAR}");
        }
        
        if (record.getMid() != null) {
            VALUES("mid", "#{mid,jdbcType=CHAR}");
        }
        
        return SQL();
    }

    public String updateByPrimaryKeySelective(PermissionMenu record) {
        BEGIN();
        UPDATE("permission_menu");
        
        if (record.getPid() != null) {
            SET("pid = #{pid,jdbcType=CHAR}");
        }
        
        if (record.getMid() != null) {
            SET("mid = #{mid,jdbcType=CHAR}");
        }
        
        WHERE("sid = #{sid,jdbcType=CHAR}");
        
        return SQL();
    }
}